
*------------------------------------------------------------------------------------
* Table B4 -- Tests of Differential Attrition
*------------------------------------------------------------------------------------

preserve

*stat: what share was ever surveyed post-baseline?
bys ent_id: egen ever_surveyed = max(finish_flag)
sum ever_surveyed if wave_flag == 1

reg ever_surveyed ib6.treatment i.strata if wave_flag == 1, r
	qui sum ever_surveyed if wave_flag == 1
	estadd scalar mean = r(mean)	
	qui test 1.treatment = 2.treatment = 3.treatment = 4.treatment = 5.treatment = 0 
	estadd scalar joint_pval = r(p)
	estadd local wave "All"
	eststo attrition_ever
	
reg finish_flag ib6.treatment i.strata i.wave_flag, cluster(ent_id)
	qui sum finish_flag
	estadd scalar mean = r(mean)
	qui test 1.treatment = 2.treatment = 3.treatment = 4.treatment = 5.treatment = 0 
	estadd scalar joint_pval = r(p)
	estadd local wave "Pooled"
	eststo attrition	
	
forvalues w=1/4{	
	
reg finish_flag ib6.treatment i.strata if wave_flag == `w', r
	qui sum finish_flag if e(sample)
	estadd scalar mean = r(mean)
	qui test 1.treatment = 2.treatment = 3.treatment = 4.treatment = 5.treatment = 0 
	estadd scalar joint_pval = r(p)
	estadd local wave "Follow-Up `w'"
	eststo attrition_wave`w'
}	


use "$path/Data/raw_kenya.dta", clear
gen relon_surveyed = _merge_reffollowup == 3 if _merge_reffollowup != .
recode rf_treatment (3 = 5) (2 = 6) (1 = .), gen(treatment)
label var relon_surveyed "\shortstack{Surveyed\\(Kenya)}"

gen finish_flag = .
gen ever_surveyed = .

reg relon_surveyed ib6.treatment i.ref_stratum if inlist(treatment,5,6), r
	qui sum relon_surveyed if e(sample)
	estadd scalar mean = r(mean)	
	qui test 5.treatment = 0 
	estadd scalar joint_pval = r(p)
	estadd local wave "Follow-Up 1"

	eststo attrition_relon


esttab attrition_ever attrition attrition_w* attrition_relon using "$path/Output/Appendix_B/attrition.tex", label $nostar collabels(none) nomtitle replace nolines nonumber keep(1.treatment 2.treatment 3.treatment 4.treatment 5.treatment) cells(b($stars_b fmt(%9.2f)) se(par fmt(%9.2f)) p(par([ ] ) fmt(%9.2f))) stats(wave N mean joint_pval, fmt(%s %9.0fc %12.2f %12.2fc) labels("Waves" "Observations" "Mean" "Joint Orthogonality $ p $-value")) coeflabels(1.treatment "Mentored by Ugandan" 2.treatment "Mentored by Refugee" 3.treatment "Grant Only" 4.treatment "Information Only" 5.treatment "Info. + Labeled Grant") order(5.treatment 4.treatment 3.treatment 2.treatment 1.treatment) substitute(\_ _ \$ $) ///
$stars_setup ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Tests of Differential Attrition} \label{tab:attrition}	\begin{tabular}{l*{7}{>{\centering\arraybackslash}p{2.2cm}}}\toprule \toprule &\shortstack{Ever Surveyed$^+$\\(Uganda)}&\shortstack{Surveyed\\(Uganda)}&\shortstack{Surveyed\\(Uganda)}&\shortstack{Surveyed\\(Uganda)}&\shortstack{Surveyed\\(Uganda)}&\shortstack{Surveyed\\(Uganda)}&\shortstack{Surveyed\\(Kenya)}\\") ///
posthead("\cmidrule{2-8}") ///
prefoot("&&&&&&& \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{8}{p{\linewidth}}{\footnotesize \textit{Ever Surveyed} denotes whether the individual was surveyed in any follow-up survey round. \textit{Surveyed} is defined at the survey-round level. Column 2 shows pooled ANCOVA estimates controlling for randomization-stratum and survey-wave fixed effects; Columns 3--7 show survey-round-specific estimates controlling for randomization-stratum fixed effects. Standard errors clustered at the respondent level in parentheses. Brackets and the last five rows display two-sided $ p $-values. Outcomes not pre-specified are denoted with $^+$. $stars_note}  \end{tabular} \\ \end{table}%")

estimates drop attrition_ever attrition

restore

*------------------------------------------------------------------------------------
* Table B6 -- Support for Refugee Integration (Weighted to Account for Attrition)
*------------------------------------------------------------------------------------

lasso logit finish_flag (i.strata i.wave_flag i.treatment) $cat_list $lik_list $con_list, cluster(ent_id)
predict retention, pr
gen ipw = 1/retention

*Policy Preferences
label var d1_1 "\shortstack{Supports\\Refugee\\Hosting}"
label var d1_3 "\shortstack{Supports\\More\\Refugees}"
label var d1_7 "\shortstack{Supports\\Right\\to Work}"
label var d1_5 "\shortstack{Supports\\Freedom of\\Movement}"
label var e_domain1 "\shortstack{Integration\\Policies\\Index}"
label var oyoh_yes "\shortstack{Supported\\Phone\\Campaign}"

pdslasso e_domain1 ib6.treatment (i.strata i.wave phone_survey survey_date b_domain1 $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date b_domain1) post(pds) robust cluster(ent_id) lopt(prestd)
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum b_domain1 if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
		qui sum e_domain1 if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)
			
		estimates store ipw_t2_1

local iter = 1
foreach var in d1_1 d1_3 d1_7 d1_5 {
local ++iter

pdslasso `var' ib6.treatment (i.strata i.wave phone_survey survey_date missing_b`var' b`var' $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date missing_b`var' b`var') post(pds) robust cluster(ent_id) lopt(prestd)
		
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum b`var' if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
		qui sum `var' if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)			
			
		estimates store ipw_t2_`iter'
	}
	
pdslasso oyoh_yes ib6.treatment (i.strata $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata) post(pds) robust cluster(ent_id) lopt(prestd)
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum oyoh_yes if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)
		estadd scalar b_mean = .
			
		estimates store ipw_t2_6

esttab ipw_t2_* using "$path/Output/Appendix_B/ipw_t2.tex", label collabels(none) replace nolines nonumber keep(1.treatment 2.treatment 3.treatment 4.treatment 5.treatment) cells(b($stars_b fmt(%9.2f)) se(par fmt(%9.2f)) p(par([ ] ) fmt(%9.2f))) stats(N b_mean post_mean p1 p2 p3 p4 p5, fmt(%9.0fc %12.2fc %12.2fc %9.2f %9.2f %9.2f %9.2f %9.2f) labels("Observations" "Control Mean: Baseline" "Control Mean: Follow-Ups" "Labeled Grant = Info Only" "Labeled Grant = Grant Only" "Labeled Grant = R-Mentee" "R-Mentee = Info Only" "R-Mentee = U-Mentee")) coeflabels(1.treatment "Mentored by Ugandan" 2.treatment "Mentored by Refugee" 3.treatment "Grant Only" 4.treatment "Information Only" 5.treatment "Info. + Labeled Grant") order(5.treatment 4.treatment 3.treatment 2.treatment 1.treatment) substitute(\_ _ \$ $) ///
$stars_setup ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Support for Refugee Integration (Weighted to Account for Attrition)} \label{tab:ipw_t2}	\begin{tabular}{l*{6}{>{\centering\arraybackslash}p{1.6cm}}}\toprule \toprule ") ///
posthead("\cmidrule{2-7}") ///
prefoot("& & & & & & \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{7}{p{\linewidth}}{\footnotesize An observation is a surveyed respondent per post-baseline survey round in Uganda. Results estimated through ANCOVA regression with baseline controls selected through double lasso. All regressions weight observations by the probability of survey retention, estimated using lasso logit regression. Standard errors clustered at the enterprise level in parentheses; two-sided $ p $-values in brackets. $stars_note}  \end{tabular} \\ \end{table}%")

estimates drop ipw_t2_*




*------------------------------------------------------------------------------------
* Table B7 -- Beliefs About Economic Impacts of Hosting Refugees (Weighted to Account for Attrition)
*------------------------------------------------------------------------------------

label var d19_4 "\shortstack{Associated\\Support w\\Refugees}"
gen missing_bd19_4 = 0
gen bd19_4 = 0

pdslasso e_domain4 ib6.treatment (i.strata i.wave phone_survey survey_date b_domain4 $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date b_domain4) post(pds) robust cluster(ent_id) lopt(prestd)
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum b_domain4 if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
		qui sum e_domain4 if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)
			
		estimates store ipw_t3_1

local iter = 1
foreach var in d19_4 d3_3 d4_2 d4_3 d4_4 {
local ++iter

pdslasso `var' ib6.treatment (i.strata i.wave phone_survey survey_date missing_b`var' b`var' $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date missing_b`var' b`var') post(pds) robust cluster(ent_id) lopt(prestd)
		
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum b`var' if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
		qui sum `var' if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)			
			
		estimates store ipw_t3_`iter'
	}
	

esttab ipw_t3_* using "$path/Output/Appendix_B/ipw_t3.tex", label collabels(none) replace nolines nonumber keep(1.treatment 2.treatment 3.treatment 4.treatment 5.treatment) cells(b($stars_b fmt(%9.2f)) se(par fmt(%9.2f)) p(par([ ] ) fmt(%9.2f))) stats(N b_mean post_mean p1 p2 p3 p4 p5, fmt(%9.0fc %12.2fc %12.2fc %9.2f %9.2f %9.2f %9.2f %9.2f) labels("Observations" "Control Mean: Baseline" "Control Mean: Follow-Ups" "Labeled Grant = Info Only" "Labeled Grant = Grant Only" "Labeled Grant = R-Mentee" "R-Mentee = Info Only" "R-Mentee = U-Mentee")) coeflabels(1.treatment "Mentored by Ugandan" 2.treatment "Mentored by Refugee" 3.treatment "Grant Only" 4.treatment "Information Only" 5.treatment "Info. + Labeled Grant") order(5.treatment 4.treatment 3.treatment 2.treatment 1.treatment) substitute(\_ _ \$ $) ///
$stars_setup ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Beliefs About Economic Impacts of Hosting Refugees (Weighted to Account for Attrition)} \label{tab:ipw_t3}	\begin{tabular}{l*{6}{>{\centering\arraybackslash}p{1.6cm}}}\toprule \toprule ") ///
posthead("\cmidrule{2-7}") ///
prefoot("& & & & & & \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{7}{p{\linewidth}}{\footnotesize An observation is a surveyed respondent per post-baseline survey round in Uganda. Results estimated through ANCOVA regression with baseline controls selected through double lasso. All regressions weight observations by the probability of survey retention, estimated using lasso logit regression. Standard errors clustered at the enterprise level in parentheses; two-sided $ p $-values in brackets. $stars_note}  \end{tabular} \\ \end{table}%")

estimates drop ipw_t3_*
drop missing_bd19_4 bd19_4


*------------------------------------------------------------------------------------
* Table B8 -- Social Attitudes Toward Refugees (Weighted to Account for Attrition)
*------------------------------------------------------------------------------------

pdslasso e_domain6 ib6.treatment (i.strata i.wave phone_survey survey_date b_domain6 $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date b_domain6) post(pds) robust cluster(ent_id) lopt(prestd)
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum b_domain6 if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
		qui sum e_domain6 if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)
			
		estimates store ipw_t4_1

local iter = 1
foreach var in d6_2_tmp3 d6_2_tmp1 d6_4 d6_1 d6_3 {
local ++iter


pdslasso `var' ib6.treatment (i.strata i.wave phone_survey survey_date missing_b`var' b`var' $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date missing_b`var' b`var') post(pds) robust cluster(ent_id) lopt(prestd)
	
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum `var' if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)
		qui sum b`var' if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
			
		estimates store ipw_t4_`iter'
}

esttab ipw_t4_* using "$path/Output/Appendix_B/ipw_t4.tex", label collabels(none) replace nolines nonumber keep(1.treatment 2.treatment 3.treatment 4.treatment 5.treatment) cells(b($stars_b fmt(%9.2f)) se(par fmt(%9.2f)) p(par([ ] ) fmt(%9.2f))) stats(N b_mean post_mean p1 p2 p3 p4 p5, fmt(%9.0fc %12.2fc %12.2fc %9.2f %9.2f %9.2f %9.2f %9.2f) labels("Observations" "Control Mean: Baseline" "Control Mean: Follow-Ups" "Labeled Grant = Info Only" "Labeled Grant = Grant Only" "Labeled Grant = R-Mentee" "R-Mentee = Info Only" "R-Mentee = U-Mentee")) coeflabels(1.treatment "Mentored by Ugandan" 2.treatment "Mentored by Refugee" 3.treatment "Grant Only" 4.treatment "Information Only" 5.treatment "Info. + Labeled Grant") order(5.treatment 4.treatment 3.treatment 2.treatment 1.treatment) substitute(\_ _ \$ $) ///
$stars_setup ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Cultural Attitudes Toward Refugees (Weighted to Account for Attrition)} \label{tab:ipw_t4}	\begin{tabular}{l*{6}{>{\centering\arraybackslash}p{1.4cm}}}\toprule \toprule ") ///
posthead("\cmidrule{2-7}") ///
prefoot("& & & & & & \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{7}{p{\linewidth}}{\footnotesize An observation is a surveyed respondent per post-baseline survey round in Uganda. Results estimated through ANCOVA regression with baseline controls selected through double lasso. All regressions weight observations by the probability of survey retention, estimated using lasso logit regression. Standard errors clustered at the enterprise level in parentheses; two-sided $ p $-values in brackets. $stars_note}  \end{tabular} \\ \end{table}%")

estimates drop ipw_t4_*


*------------------------------------------------------------------------------------
* Table B9 -- Business Outcomes and Household Welfare (Weighted to Account for Attrition)
*------------------------------------------------------------------------------------

label var d2_1_stat "\shortstack{Business\\Profits\\(USD/Month)}"
label var d9_2_stat "\shortstack{Business\\Capital\\(USD)}"

local iter = 0

foreach var in domain9 domain10{
local ++iter

	pdslasso e_`var' ib6.treatment (i.strata i.wave phone_survey survey_date b_`var' $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date b_`var') post(pds) robust cluster(ent_id) lopt(prestd)
	
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum e_`var' if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)
		qui sum b_`var' if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
			
		estimates store ipw_t5_`iter'
}

foreach var in d2_1 d9_2{
local ++iter

	pdslasso `var'_stat ib6.treatment (i.strata i.wave phone_survey survey_date missing_b`var' b`var'_stat $cat_list $lik_list $con_list) [pweight=ipw], partial(i.strata i.wave phone_survey survey_date missing_b`var' b`var'_stat) post(pds) robust cluster(ent_id) lopt(prestd)
	
		test 4.treatment = 5.treatment
		estadd scalar p1 = r(p)
		test 3.treatment = 5.treatment
		estadd scalar p2 = r(p)
		test 2.treatment = 5.treatment
		estadd scalar p3 = r(p)
		test 2.treatment = 4.treatment
		estadd scalar p4 = r(p)
		test 1.treatment = 2.treatment
		estadd scalar p5 = r(p)
		
		qui sum `var'_stat if treatment == 6 & e(sample)
		estadd scalar post_mean = r(mean)
		qui sum b`var'_stat if treatment == 6 & finish_flag == 1
		estadd scalar b_mean = r(mean)
			
		estimates store ipw_t5_`iter'
}


esttab ipw_t5_2 ipw_t5_3 ipw_t5_4 ipw_t5_1 using "$path/Output/Appendix_B/ipw_t5.tex", label collabels(none) replace nolines nonumber keep(1.treatment 2.treatment 3.treatment 4.treatment 5.treatment) cells(b($stars_b fmt(%9.2f)) se(par fmt(%9.2f)) p(par([ ] ) fmt(%9.2f))) stats(N b_mean post_mean p1 p2 p3 p4 p5, fmt(%9.0fc %12.2fc %12.2fc %9.2f %9.2f %9.2f %9.2f %9.2f) labels("Observations" "Control Mean: Baseline" "Control Mean: Follow-Ups" "Labeled Grant = Info Only" "Labeled Grant = Grant Only" "Labeled Grant = R-Mentee" "R-Mentee = Info Only" "R-Mentee = U-Mentee")) coeflabels(1.treatment "Mentored by Ugandan" 2.treatment "Mentored by Refugee" 3.treatment "Grant Only" 4.treatment "Information Only" 5.treatment "Info. + Labeled Grant") order(5.treatment 4.treatment 3.treatment 2.treatment 1.treatment) substitute(\_ _ \$ $) ///
$stars_setup ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Business Outcomes and Household Welfare (Weighted to Account for Attrition)} \label{tab:ipw_t5}	\begin{tabular}{l*{4}{>{\centering\arraybackslash}p{2cm}}}\toprule \toprule ") ///
posthead("\cmidrule{2-5}") ///
prefoot("& & & & \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{5}{p{0.84\linewidth}}{\footnotesize An observation is a surveyed respondent per post-baseline survey round in Uganda. Results estimated through ANCOVA regression with baseline controls selected through double lasso. All regressions weight observations by the probability of survey retention, estimated using lasso logit regression. Standard errors clustered at the enterprise level in parentheses; two-sided $ p $-values in brackets. $stars_note}  \end{tabular} \\ \end{table}%")

estimates drop ipw_t5_*



*------------------------------------------------------------------------------------
* Table B10 -- Lee Bounds, Domains 1-9
*------------------------------------------------------------------------------------

estimates clear
foreach domain_num in 1 2 3 4 51 52 6 7 8 9 10 11 12 13 14 15 16 171{
	
*estimate and store leebounds
label var cashinfo "Info. + Labeled Grant"
label var umentee "Mentored by Ugandan"
label var rmentee "Mentored by Refugee"
label var cash "Grant Only"
label var info "Information Only"

	eststo umentee_`domain_num': leebounds lee_outcome_`domain_num' umentee if max(umentee,control) == 1, select(finish_flag)
	eststo rmentee_`domain_num': leebounds lee_outcome_`domain_num' rmentee if max(rmentee,control) == 1, select(finish_flag)
	eststo cash_`domain_num': leebounds lee_outcome_`domain_num' cash if max(cash,control) == 1, select(finish_flag)
	eststo info_`domain_num': leebounds lee_outcome_`domain_num' info if max(info,control) == 1, select(finish_flag)
	eststo cashinfo_`domain_num': leebounds lee_outcome_`domain_num' cashinfo if max(cashinfo,control) == 1, select(finish_flag)
}

*first set of 11 domains
esttab cashinfo_1 cashinfo_2 cashinfo_3 cashinfo_4 cashinfo_6 cashinfo_7 cashinfo_8 cashinfo_9 using "$path/Output/Appendix_B/leebounds1.tex", label nostar nomtitles collabels(none) replace nolines nonumber cells(ci(par fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations"))  substitute(\_ _ \$ $) ///
prehead("\begin{table}[H]	\centering	\footnotesize	\caption{Lee Bounds on Treatment Impacts, Domains 1--9} \label{tab:leebounds1}	\begin{tabular}{l*{8}{>{\centering\arraybackslash}p{2cm}}}\toprule \toprule &\shortstack{Integration\\Policies\\Index\\~}&\shortstack{Profit\\(Standardized)\\~\\~}&\shortstack{Refugee\\Knowledge\\Index\\~}&\shortstack{Economic\\Beliefs\\Index\\~}&\shortstack{Cultural\\Attitudes\\Index\\~}&\shortstack{Contact\\Refugees\\by Choice\\Index}&\shortstack{Contact\\Refugees\\by Circumst.\\Index}&\shortstack{Business\\Practices\\Index\\~}\\") ///
posthead("\cmidrule{2-9}") ///
prefoot("") ///
postfoot("")

foreach group in info cash rmentee{
	
esttab `group'_1 `group'_2 `group'_3 `group'_4 `group'_6 `group'_7 `group'_8 `group'_9 using "$path/Output/Appendix_B/leebounds1.tex", label nostar nomtitles collabels(none) append nolines nonumber cells(ci(par fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations"))  substitute(\_ _ \$ $) prehead("") posthead("& & & & & & & & \\") prefoot("") postfoot("")
	
}

esttab umentee_1 umentee_2 umentee_3 umentee_4 umentee_6 umentee_7 umentee_8 umentee_9  using "$path/Output/Appendix_B/leebounds1.tex", label nostar nomtitles collabels(none) append nolines nonumber cells(ci(par fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations"))  substitute(\_ _ \$ $) prehead("") posthead("& & & & & & & & \\") ///
prefoot("& & & & & & & & \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{9}{p{\linewidth}}{\footnotesize Each cell shows a 95\% confidence interval for an upper or lower Lee bound. Lee bounds estimated using only the control group and one treatment group in Uganda. Each outcome is the residual from an ANCOVA regression of the domain summary index on a randomization-stratum and survey-wave fixed effect, a dummy for whether the survey was conducted over the phone, a linear survey date control, and the baseline value of the summary index.}  \end{tabular} \\ \end{table}%")




*------------------------------------------------------------------------------------
* Table B11 -- Lee Bounds, Domains 10-17
*------------------------------------------------------------------------------------

esttab cashinfo_10 cashinfo_11 cashinfo_12 cashinfo_13 cashinfo_14 cashinfo_15 cashinfo_16 cashinfo_171 using "$path/Output/Appendix_B/leebounds2.tex", label nostar nomtitles collabels(none) replace nolines nonumber cells(ci(par fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations"))  substitute(\_ _ \$ $) ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Lee Bounds on Treatment Impacts, Domains 10--17} \label{tab:leebounds2}	\begin{tabular}{l*{8}{>{\centering\arraybackslash}p{2cm}}}\toprule \toprule                      &\shortstack{Household\\Well-Being\\Index\\~}&\shortstack{General\\Policy\\Index\\~}&\shortstack{Foreigners:\\Economic\\Beliefs\\Index}&\shortstack{Foreigners:\\Cultural\\Attitudes\\Index}&\shortstack{Other Tribes:\\Contact\\Index\\~}&\shortstack{Other Tribes:\\Economic\\Beliefs\\Index}&\shortstack{Other Tribes:\\Cultural\\Attitudes\\Index}&\shortstack{Gender\\Role\\Index\\~}\\") ///
posthead("\cmidrule{2-9}") ///
prefoot("") ///
postfoot("")

foreach group in info cash rmentee{
	
esttab `group'_10 `group'_11 `group'_12 `group'_13 `group'_14 `group'_15 `group'_16 `group'_171 using "$path/Output/Appendix_B/leebounds2.tex", label nostar nomtitles collabels(none) append nolines nonumber cells(ci(par fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations"))  substitute(\_ _ \$ $) prehead("") posthead("& & & & & & & & \\") prefoot("") postfoot("")
	
}

esttab umentee_10 umentee_11 umentee_12 umentee_13 umentee_14 umentee_15 umentee_16 umentee_171 using "$path/Output/Appendix_B/leebounds2.tex", label nostar nomtitles collabels(none) append nolines nonumber cells(ci(par fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations"))  substitute(\_ _ \$ $) prehead("") posthead("& & & & & & & & \\") ///
prefoot("& & & & & & & & \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{9}{p{\linewidth}}{\footnotesize Each cell shows a 95\% confidence interval for an upper or lower Lee bound. Lee bounds estimated using only the control group and one treatment group in Uganda. Each outcome is the residual from an ANCOVA regression of the domain summary index on a randomization-stratum and survey-wave fixed effect, a dummy for whether the survey was conducted over the phone, a linear survey date control, and the baseline value of the summary index.}  \end{tabular} \\ \end{table}%")

estimates drop umentee_* rmentee_* cash_* info_* cashinfo_*




*------------------------------------------------------------------------------------
* Table B12 -- Assignment and Actual Treatment Status
*------------------------------------------------------------------------------------

preserve

keep if wave_flag == 1

bys treatment: egen assigned = total(wave_flag)
bys treatment: egen treated_tot = total(wave_flag & treated != 6)

gen treated_bin = (treated != 6)
bys treatment: egen treated_pct = mean(treated_bin)
replace treated_pct = treated_pct * 100

recode treatment (5=1) (4=2) (2=4) (1=5)

la def treatment 1 "Info. + Labeled Grant" 2 "Information Only" 3 "Grant Only" 4 "Mentored by Refugee" 5 "Mentored by Ugandan" 6 "Control"
la val treatment treatment

* Layout adjusted manually to horizontal
estpost tabstat assigned, statistics(mean) by(treatment) nototal
esttab . using "$path/Output/Appendix_B/treatment_status.tex", cells(mean) nomtitle nonumber noobs nostar nomtitles collabels(none) nolines replace substitute(\_ _ \$ $) prehead("\begin{table}[H]     \centering  \footnotesize   \caption{Assignment and Actual Treatment Status} \label{tab:treat_status}   \begin{tabular}{l*{6}{>{\centering\arraybackslash}p{2cm}}} \toprule & \shortstack{Labeled\\Grant} & \shortstack{Information\\Only} & \shortstack{Grant\\Only} &\shortstack{Mentored\\by Refugee} & \shortstack{Mentored\\by Ugandan} & Control \\  \cmidrule{2-7}") postfoot("\\")

estpost tabstat treated_tot, statistics(mean) by(treatment) nototal
esttab . using "$path/Output/Appendix_B/treatment_status.tex", cells(mean) nomtitle nonumber noobs nostar nomtitles collabels(none) nolines append substitute(\_ _ \$ $) prehead("") postfoot("\\")

estpost tabstat treated_pct, statistics(mean) by(treatment) nototal
esttab . using "$path/Output/Appendix_B/treatment_status.tex", cells(mean(fmt(%9.0f))) nomtitle nonumber noobs nostar nomtitles collabels(none) nolines append substitute(\_ _ \$ $) prehead("") postfoot("\bottomrule \multicolumn{8}{p{0.85\linewidth}}{\footnotesize Source: YARID Administrative data. Each cell shows the number of respondents who were assigned to, and actually treated with, a given treatment arm in Uganda.}  \end{tabular} \\ \end{table}%")

restore


*------------------------------------------------------------------------------------
* Table B13 -- Facilitated Mentorship Meetings
*------------------------------------------------------------------------------------


la def treatment_int 1 "\hspace{5pt} Standard U" 2 "\hspace{5pt} Standard R" 7 "\hspace{5pt} Intensive U" 8 "\hspace{5pt} Intensive R"
la val treatment_int treatment_int

gen one_inperson = (num_mentorship_inperson > 0 & num_mentorship_inperson != .) * 100
gen one_phone = (num_mentorship_phone > 0 & num_mentorship_phone != .) * 100

gen max_inperson = 6 if inlist(treatment_int,7,8)
replace max_inperson = 3 if inlist(treatment_int,1,2)

gen max_phone = 4
bys treatment_int: egen obs = total(wave_endline2)

* Change manually column titles: Mentored by Refugee (All), Standard, Intensive; Row Order (Total on top); Total rows amended manually for max number and N
estpost tabstat num_mentorship_inperson one_inperson max_inperson num_mentorship_phone one_phone max_phone obs if treatment == 2 & wave_endline2 == 1, statistics(mean) by(treatment_int)
esttab . using "$path/Output/Appendix_B/mentorship_meetings.tex", cells("num_mentorship_inperson(fmt(a1)) one_inperson(fmt(%9.0f)) max_inperson num_mentorship_phone(fmt(a1)) one_phone(fmt(%9.0f)) max_phone obs") nomtitle nonumber noobs label nostar nomtitles collabels(none) nolines replace substitute(\_ _ \$ $) prehead("\begin{table}[h]     \centering  \footnotesize   \caption{Facilitated Mentorship Meetings} \label{tab:mentorship_meetings}   \begin{tabular}{l*{7}{>{\centering\arraybackslash}p{1.2cm}}} \toprule &\multicolumn{3}{c}{In-Person (2020)} &\multicolumn{3}{c}{Phone (2021)} & \\ \cmidrule(l{2pt}r{2pt}){2-4} \cmidrule(l{2pt}r{2pt}){5-7} & \shortstack{Mean\\Num.} & \shortstack{At Least\\One (\%)} & \shortstack{Max\\Num.} & \shortstack{Mean\\Num.} & \shortstack{At Least\\One (\%)} & \shortstack{Max\\Num.} & N \\ \toprule") postfoot("\\")

estpost tabstat num_mentorship_inperson one_inperson max_inperson num_mentorship_phone one_phone max_phone obs if treatment == 1 & wave_endline2 == 1, statistics(mean) by(treatment_int)
esttab . using "$path/Output/Appendix_B/mentorship_meetings.tex", cells("num_mentorship_inperson(fmt(a1)) one_inperson(fmt(%9.0f)) max_inperson num_mentorship_phone(fmt(a1)) one_phone(fmt(%9.0f)) max_phone obs") nomtitle nonumber noobs label nostar nomtitles  collabels(none) nolines append substitute(\_ _ \$ $) prehead("") postfoot("\bottomrule \multicolumn{8}{p{0.85\linewidth}}{\footnotesize Source: YARID Administrative data}  \end{tabular} \\ \end{table}%")

*------------------------------------------------------------------------------------
* Table B14 -- Cost Effectiveness
*------------------------------------------------------------------------------------

preserve

clear all
local admin_cost = 27
set obs 6

gen arm = _n
label define arms 1 "Labeled Grant (Uganda)" 2 "Information Only (Uganda)" 3 "Grant Only (Uganda)" 4 "Mentored by Refugee (Uganda)" 5 "Labeled Grant (Kenya)" 6 "Grant Only (Kenya)"
label values arm arms

gen impact = 13 in 1
	replace impact = 6 in 2
	replace impact = 9 in 3
	replace impact = 4 in 4
	replace impact = 16 in 5
	replace impact = 6 in 6
gen cost = 126 + `admin_cost' in 1 // ITT 
	replace cost = 12 + `admin_cost' in 2
	replace cost = 126 + `admin_cost' in 3
	replace cost = 105 + `admin_cost' in 4 
	replace cost = 8 + 12 + `admin_cost' in 5
	replace cost = 8 + 12 + `admin_cost' in 6
gen cost_per_change = cost/impact

estpost tabstat impact cost cost_per_change, statistics(mean) by(arm) nototal
esttab . using "$path/Output/Appendix_B/cost_effectiveness.tex", cells("impact(fmt(%9.0f)) cost(fmt(%9.0f)) cost_per_change(fmt(%9.2fc))") nonumber noobs label nostar nomtitles collabels(none) nolines replace substitute(\_ _) ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Cost Effectiveness} \label{tab:cost_effectiveness}	\begin{tabular}{l*{3}{>{\centering\arraybackslash}p{3.4cm}}}\toprule \toprule & \shortstack{Treatment Effect on\\Supports Refugee\\Hosting (pp)} & \shortstack{Cost per Person\\(USD)\\~} & \shortstack{Cost per 1 pp\\Treatment Effect\\~} \\") ///
posthead("\cmidrule{2-4}") ///
prefoot("") ///
postfoot("\bottomrule \bottomrule \multicolumn{4}{p{\linewidth}}{\footnotesize Each row is a treatment arm. Treatment effects are shown for the outcome \textquotedblleft Supports Refugee Hosting\textquotedblright (Tables \ref{tab:policy_pref} and \ref{tab:relon}, Column 2), expressed in percentage points. Costs shown in USD. Cost estimates in Uganda are calculated by dividing the realized costs for three categories---grants (combining Labeled Grant and Grant Only), Information Only, and mentorship (combining Mentored by a Refugee and Mentored by a Ugandan)---by the respective treatment arm sizes to obtain cost per person (intent-to-treat) estimates. YARID overhead costs are divided equally per targeted person---totaling \\$27 each---and added to the per person treatment costs. Cost estimates in Kenya are calculated by adding the cost of the grant (\\$7.50) to the Information Only and overhead cost estimates from Uganda. The marginal cost of labeling the grants---the additional time for the enumerator---is less than \\$0.50 and omitted.}  \end{tabular} \\ \end{table}%")

restore

